﻿IF EXISTS (SELECT * from sys.procedures p left join sys.schemas s on p.schema_id = s.schema_id where p.name='entity_update' and s.name='Crm')
DROP PROCEDURE [Crm].entity_update
GO
CREATE PROCEDURE [Crm].entity_update 
@PK uniqueidentifier, 
@Manager nvarchar(100), 
@Name nvarchar(100), 
@Company nvarchar(100), 
@Title nvarchar(20), 
@Phone varchar(15), 
@Mobile varchar(15), 
@Source nvarchar(50), 
@Url nvarchar(50), 
@Mail nvarchar(30), 
@Fax varchar(15), 
@Status nvarchar(20), 
@Skype nvarchar(30), 
@Twitter nvarchar(50), 
@Sector nvarchar(50), 
@NoMail bit, 
@Adress nvarchar(200), 
@ZipCode varchar(10), 
@City nvarchar(50), 
@Country nvarchar(50), 
@Description nvarchar(500)
AS
BEGIN
UPDATE [Crm].[Entity] 
SET	[manager] = @Manager ,
	[name] = @Name ,
	[company] = @Company ,
	[title] = @Title ,
	[phone] = @Phone ,
	[mobile] = @Mobile ,
	[source] = @Source ,
	[url] = @Url ,
	[mail] = @Mail ,
	[fax] = @Fax ,
	[status] = @Status ,
	[skype] = @Skype ,
	[twitter] = @Twitter ,
	[sector] = @Sector ,
	[no_mail] = @NoMail ,
	[adress] = @Adress ,
	[zip_code] = @ZipCode ,
	[city] = @City ,
	[country] = @Country ,
	[description] = @Description 
WHERE
	[id_Entity] = @PK 
END